<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->

<B><A HREF="UTIMES.html">UTIMES(2)</A></B>		  FreeBSD System Calls Manual		     <B><A HREF="UTIMES.html">UTIMES(2)</A></B>


</PRE>
<H2>NAME</H2><PRE>
     <B>utimes</B> - set file access and modification times


</PRE>
<H2>SYNOPSIS</H2><PRE>
     <B>#include</B> <B>&lt;sys/time.h&gt;</B>

     <I>int</I>
     <B>utimes</B>(<I>const</I> <I>char</I> <I>*file</I>, <I>const</I> <I>struct</I> <I>timeval</I> <I>*times</I>)


</PRE>
<H2>DESCRIPTION</H2><PRE>
     The <B>utimes</B>() function sets the access and modification times of the named
     file from the structures in the argument array <I>times</I>.

     The first structure is the access time, and the second is the modifica-
     tion time.

     If the times are specified (the <I>times</I> argument is non-NULL) the caller
     must be the owner of the file or be the super-user.

     If the times are not specified (the <I>times</I> argument is NULL) the caller
     must be the owner of the file, have permission to write the file, or be
     the super-user.


</PRE>
<H2>RETURN VALUES</H2><PRE>
     Upon successful completion, a value of 0 is returned.  Otherwise, a value
     of -1 is returned and <I>errno</I> is set to indicate the error.


</PRE>
<H2>ERRORS</H2><PRE>
     <B>Utimes</B>() will fail if:

     [EACCES]	   Search permission is denied for a component of the path
		   prefix; or the <I>times</I> argument is NULL and the effective us-
		   er ID of the process does not match the owner of the file,
		   and is not the super-user, and write access is denied.

     [EFAULT]	   <I>File</I> or <I>times</I> points outside the process's allocated ad-
		   dress space.

     [EIO]	   An I/O error occurred while reading or writing the affected
		   inode.

     [ELOOP]	   Too many symbolic links were encountered in translating the
		   pathname.

     [ENAMETOOLONG]
		   A component of a pathname exceeded 255 characters, or an
		   entire path name exceeded 1023 characters.

     [ENOENT]	   The named file does not exist.

     [ENOTDIR]	   A component of the path prefix is not a directory.

     [EPERM]	   The <I>times</I> argument is not NULL and the calling process's
		   effective user ID does not match the owner of the file and
		   is not the super-user.

     [EROFS]	   The file system containing the file is mounted read-only.


</PRE>
<H2>SEE ALSO</H2><PRE>
     <B><A HREF="stat.html">stat(2)</A></B>


</PRE>
<H2>HISTORY</H2><PRE>
     The <B>utimes</B>() function call appeared in 4.2BSD.
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
